const baseController = require("./baseController");
let mysql = require("../../model/base");

class indexController extends baseController {
    async index() {
        let mysqlObj = new mysql();
        let date = this.req.query['date'];
        //console.log('date-----'+date);
        let sql = 'select * from number where date=?';
        //console.log(res);
        try {
            let result = await mysqlObj.query(sql, date);
            return this.display('index.html', { data: result, title:'我是index' })
        } catch (err) {
            console.log('----------' + err);
        }
    }

    async detail() {
        let mysqlObj = new mysql();
        let date = this.req.query['date'];
        //console.log('date-----'+date);
        let sql = 'select * from number where date=?';
        //console.log(res);
        try {
            let result = await mysqlObj.query(sql, date);
            return this.display('detail.html', { data: result })
        } catch (err) {
            console.log(err);
        }
    }

}
module.exports = indexController;
